#pragma once

#include <faker/basic/System.h>
#include <faker/basic/transform/Inst.h>

#include <faker/render/mesh/box/Inst.h>
#include <faker/render/camera/firstview/Inst.h>
#include <faker/render/material/simpleColor/Inst.h>

#include <faker/basic/Vertex.h>
#include <gut/types.h>
#include <math/types.h>

namespace Faker
{
    namespace Render
    {
        struct System
        {

            bool InitResources();

            void RenderFrame(const Faker::Scene &scene);

            bool ReleaseResources();

            void OnFrameBufferSize(int width, int height);

        private:
            Gut::Shader shader;
            Math::Transform transform;
            Math::Camera camera;
            Gut::UniformBuffer passBuffer, objBuffer, matBuffer;
            Gut::MeshIndice mesh;

            struct PassData
            {
                glm::mat4 proj, view;
                glm::vec3 camPos;
                float pad;
            };
            struct ObjData
            {
                glm::mat4 world, normalMatrix;
            };
            struct MatData
            {
                glm::vec4 color;
            };

            PassData passData;
            ObjData objData;
            MatData matData;
        };
    };
}
